package jee.boot.common.rest;

import jee.boot.common.basic.CrudController;
import jee.boot.common.basic.result.ResponseMessage;
import jee.boot.common.basic.result.Result;
import jee.boot.common.service.SerialNumberService;
import jee.boot.entity.system.SerialNumber;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 序列号
 */
@RestController
@RequestMapping("/serial")
public class SerialNumberRestController extends CrudController<SerialNumberService, SerialNumber> {

    /**
     * 产生一个新的序列号
     *
     * @param entity
     * @return
     */
    @PostMapping("/newSerial")
    public ResponseMessage<SerialNumber> save(@RequestBody SerialNumber entity) {
        SerialNumber serialNumber = service.newSerial(entity);
        return Result.success(serialNumber);
    }
}
